<template>
	<view class="page">
		<view class="info_box" style="padding-bottom: 40rpx;">
			<view class="info_box_base">
				<view class="info_box_base_item">
					<u--input placeholder="请输入原密码" type="password" v-model="old_password" border="bottom"></u--input>
				</view>
				<view class="info_box_base_item">
					<u--input placeholder="请输入新密码" type="password" v-model="password" border="bottom"></u--input>
				</view>
				<view class="info_box_base_item">
					<u--input placeholder="请输再次确认新密码" type="password" v-model="new_password" border="bottom"></u--input>
				</view>
			</view>


			<view class="btn" @click="modifyPwd">确认</view>
		</view>
	</view>
</template>

<script>
	import {
		api,
		apiBaseUrl,
		http
	} from '@/config/common.js'
	export default {
		data() {
			return {
				old_password:"",
				password:"",
				new_password:''
			}
		},
		components: {},
		filters: {},
		mounted() {},
		onLoad(e) {},
		onShow() {},
		onPageScroll(e) {},
		beforeDestroy() {},
		methods: {
			modifyPwd() {
				uni.showLoading({})
				api.post('/api/shop/editpwd', {old_password:this.old_password,password:this.password,new_password:this.new_password}).then(res => {
					let rst = res.data
					uni.hideLoading() 
					if (rst.code == 1) {
						 uni.$u.toast("修改成功，请重新登录")
						 setTimeout(function() {
							 uni.clearStorageSync()
							 uni.navigateTo({
							 	url:'/pages/login/index'
							 })
						 }, 1000);
					} else{
						uni.$u.toast(rst.msg)
					}
			
				}).catch(err => {
					uni.hideLoading()
				})
			},
		}
	};
</script>

<style scoped>
	.info_box_base_btns_item_active {
		background-color: rgb(242, 64, 64) !important;
	}

	.info_box_base_btns_item {
		font-size: 25rpx;
		text-align: center;
		color: rgb(51, 51, 51);
		white-space: pre-wrap;
		word-break: break-word;
		max-width: 148rpx;
		background-color: rgb(17, 200, 97);
		padding: 10rpx 20rpx;
		border-radius: 10rpx;
		margin-right: 40rpx;
		margin-top: 20rpx;
	}

	.info_box_base_btns {
		display: flex;
		flex-direction: row;
		align-items: center;
		flex-wrap: wrap;
	}

	.btn {
		width: 500rpx;
		height: 80rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		margin: 0 auto;
		margin-top: 40rpx;
		background-color: rgb(70, 179, 255);
		color: #fff;
		border-radius: 40rpx;
		font-size: 32rpx;
	}

	::v-deep .uni-input-input {
		font-size: 26rpx;
	}

	::v-deep .uni-input-placeholder {
		font-size: 26rpx;
	}

	.info_box_base_item_img_title {
		font-size: 25rpx;
		margin: 20rpx 0;
	}

	.gcxt_b_wy_reason {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.gcxt_b_wy {
		display: flex;
		flex-direction: row;
		align-items: center;
		margin: 20rpx 0;
	}

	.info_box_base {
		/* border: 1px solid rgb(235, 229, 229); */
		padding: 20rpx;
		font-size: 25rpx;
		margin-top: 20rpx;
	}

	.info_box_base_item {
		line-height: 45rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-bottom: 10rpx;
	}

	.info_box {
		width: 710rpx;
		margin: 0 auto;

	}

	page {
		background-color: #fff;
	}
</style>